Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be
Posted
by Mikey John
on Stack Overflow
See other posts from Stack Overflow
or by Mikey John
Published on 2010-04-28T10:33:44Z
Indexed on
2010/04/28
11:13 UTC
Read the original article
Hit count: 323
Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be done ?
Here's my stored procedure:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO
ALTER PROCEDURE [dbo].[AddPerson]
@Data AS XML
AS
INSERT INTO Persons (name,image_binary)
SELECT
rowWals.value('./@Name', 'varchar(64)') AS [Name],
rowWals.value('./@ImageBinary', 'varbinary(MAX)') AS [ImageBinary]
FROM
@Data.nodes ('/Data/Names') as b(rowVals)
SELECT SCOPE_IDENTITY() AS Id
In my schema Name is of type String and ImageBinary is o type byte[].
© Stack Overflow or respective owner